<?php 
session_start();
if(isset($_SESSION['s_username'])){
	$action = $_GET['action'];
	$clientesId = $_GET['clientesId'];	
	
?>
<?php if($action == 'add') {?>
<div id="errorBoxClientes"></div>
<form action="phpScripts/clientes/saveClientesAction.php" enctype="multipart/form-data" id="clientesForm" class="form-horizontal">
	<div class="control-group">
		<label class="control-label">Imágen</label>
		<div class="controls">
			<div class="input-append">
			   <input id="imageClientes" type="file" style="display:none"  name="clientesImagen">
			   <input id="imageClientesCover" class="input-large" type="text" required/>
			   <span class="btn" onclick="$('input[id=imageClientes]').click();">Examinar</span>					   				   
			</div>
			<span class="ayuda">Solo se permiten imágenes tipo JPEG, PNG</span>					
		</div>						 
	</div>									
	<div class="control-group">
		<div class="controls">
			<button type="submit" class="btn btn-info">Guardar</button>&nbsp;&nbsp;<img alt="loader" id="imgLoader" style="display:none" src="images/loaderImg.gif">
		</div>
	</div>
</form>
<script>
$('input[id=imageClientes]').change(function() {
   $('#imageClientesCover').val(basename($(this).val()));
});
submitForm('#clientesForm','#errorBoxClientes',null);
</script>
<?php }else{?>
<div id="errorBoxClientesUpdate"></div>
<form action="phpScripts/clientes/updateClientesAction.php?clientesId=<?php echo $clientesId?>" enctype="multipart/form-data" id="clientesFormUpdate" class="form-horizontal">
	<div class="control-group">
		<label class="control-label">Imágen</label>
		<div class="controls">
			<div class="input-append">
			   <input id="imageClientesUpdate" type="file" style="display:none"  name="clientesImagenUpdate">
			   <input id="imageClientesCoverUpdate" class="input-large" type="text" required/>
			   <span class="btn" onclick="$('input[id=imageClientesUpdate]').click();">Examinar</span>					   				   
			</div>
			<span class="ayuda">Solo se permiten imágenes tipo JPEG,PNG</span>					
		</div>						 
	</div>									
	<div class="control-group">
		<div class="controls">
			<button type="submit" class="btn btn-info">Guardar</button>&nbsp;&nbsp;<img alt="loader" id="imgLoader" style="display:none" src="images/loaderImg.gif">
		</div>
	</div>
</form>
<script>
$('input[id=imageClientesUpdate]').change(function() {
   $('#imageClientesCoverUpdate').val(basename($(this).val()));
});
submitForm('#clientesFormUpdate','#errorBoxClientesUpdate',succesUpdateClientes);
</script>
<?php } ?>

<?php 
}else{
	header ("location: ../../index.php");
}
?>